package org.example.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.example.entity.DishEntity;
import org.example.entity.ResultMap;
import org.example.service.DishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PageController {


    @Autowired
    DishService dishService;

    @RequestMapping("/getDishList/{pagenum}/{pageSize}")
    public ResultMap<IPage<DishEntity>> getDishList(@PathVariable("pagenum") int pagenum, @PathVariable("pageSize") int pageSize) {
        ResultMap<IPage<DishEntity>> resultMap = new ResultMap<>();
        IPage<DishEntity> dishList = dishService.getDishList(pagenum, pageSize);
        resultMap.setResult(dishList);
        return resultMap;
    }
}
